﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace The_LarX
{
    public class GameScreensList : List<GameScreen>
    {
        /// <summary>
        /// Method for checking if this List contains a GameScreen
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public virtual bool Contains(string name)
        {
            for (int i = 0; i < this.Count; i++)
                if (this[i].Name == name)
                    return true;
            return false;
        }

        /// <summary>
        /// Gets a Screen by it's name
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public virtual GameScreen GetScreen(string name)
        {
            for (int i = 0; i < this.Count; i++)
                if (this[i].Name == name)
                    return this[i];
            return null;
        }

        public virtual GameScreen GetEditorScreen()
        {
            return GetScreen("EditorScreen");
        }

        public virtual void Order()
        {
            Engine.GameScreens.Sort(GameScreen.DrawOrderComparison);
        }
    }
}
